import request from '@/utils/request';
import { stringify } from 'qs';
import { toFormData } from '@/utils/utils.jsx';

// 列表数据
export async function getPriceList(params) {
  return request(`/blade-goods/good/price/page?${stringify(params)}`);
}

// 改价审核日志列表
export async function getLogList(params) {
  return request(`/blade-goods/goodsvippricelog/page?${stringify(params)}`);
}

// 自定义改价日志列表
export async function getGoodsCustomLogList(params) {
    return request(`/blade-goods/goodsCustomChangeLog/page?${stringify(params)}`);
  }

//供应商匹配改价
export async function custompricecheckOp(params) {
  return request(`/blade-goods/custompricecheck/list?${stringify(params)}`);
}

// 供应商下拉 (过滤同账号店铺)
export async function getzjfstoreList(params) {
  return request(`/blade-goods/zjfstore/list/vipGoodsPriceQueryPage?${stringify(params)}`);
}

//删除会员价
export async function deletePriceOp(params) {
  return request(`/blade-goods/good/price/delete`, {
    method: 'DELETE',
    data: params,
  });
}

//提交申请
export async function postApplyDataOp(params) {
  return request(`/blade-goods/good/price/toWaitVerify`, {
    method: 'POST',
    data: params,
  });
}

// 添加弹窗检索（按尺码/花型聚合）
export async function getSpecList(params) {
  return request(`/blade-goods/zjfgoods/specList?${stringify(params)}`);
}

// 添加商品操作
export async function addGoodsOperator(params) {
  return request(`/blade-goods/good/price/add`, {
    method: 'POST',
    data: params,
  });
}

//重新申请会员价
export async function vipPriceReApplyOp(params) {
  return request(`/blade-goods/good/price/reapply`, {
    method: 'POST',
    data: params,
  });
}

//会员价导入
export async function exportVipPrice(params) {
    return request(`/blade-goods/good/price/import`, {
      method: 'post',
      body: toFormData(params)
    });
  }

  // 通过uuid查询 会员价改价配置
export async function getVipPriceConfigOp(params) {
  return request(`/blade-goods/goodsVipPriceSetting/oneByUuid?${stringify(params)}`);
}

//新增或修改 会员价改价配置
export async function setVipPriceConfigOp(params) {
  return request(`/blade-goods/goodsVipPriceSetting/submit`, {
    method: 'post',
    data: params
  });
}

//改价审核(通过 or 拒绝)
export async function changePriceAuditOp(params) {
  return request(`/blade-goods/good/price/audit`, {
    method: 'post',
    data: params
  });
}

//供应商匹配改价审核  通过
export async function customAuditPassOp(params) {
  return request(`/blade-goods/custompricecheck/pass`, {
    method: 'post',
    body: toFormData(params)
  });
}

//供应商匹配改价审核  拒绝
export async function customAuditRefuseOp(params) {
  return request(`/blade-goods/custompricecheck/refuse`, {
    method: 'post',
    data: params
  });
}

//获取关联订单号
export async function getRelativeOrderOp(params, type) {
  return request(`/zjf-oms/order/price/change/detail/${params}?${stringify(type)}`);
}

//改价审核日志导出
export async function exprotForTab6Op(params) {
  return request(`/blade-goods/custompricecheck/exportCustomPriceCheck?${stringify(params)}`);
}

//改价审核日志关联订单号导出
export async function exprotForTab6RelativeOp(params) {
  return request(`/blade-goods/custompricecheck/exportCustomPriceCheckDocument?${stringify(params)}`);
}

//自定义改价日志导出
export async function exprotForTab7Op(params) {
  return request(`/blade-goods/goodsCustomChangeLog/exportCustomChangeLog?${stringify(params)}`);
}

//自定义改价日志关联订单号导出
export async function exprotForTab7RelativeOp(params) {
  return request(`/blade-goods/goodsCustomChangeLog/exportCustomChangeLogDocument?${stringify(params)}`);
}